﻿using InteControlSys.SampleService;
using InteControlSys.ViewModel;
using Microsoft.Win32;
using PropertyTools.Wpf;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml.Linq;
using System.Threading;

namespace InteControlSys.ViewModel
{
    public class TrainBatchViewModel : NodeViewModel
    {
        public SampleService.SampleClient sp = new SampleClient("WSHttpBinding_ISample");
        public SampleCommon sc = new SampleCommon();

        public TrainBatchViewModel(string name)
        {
            this.Name = name;
            this.Parent = null;
            this.IsExpanded = true;
            this.NodeType = "TrainBatchViewModel";
            this.OperatingTruckList = new ObservableCollection<NodeViewModel>();
            Init();
        }

        public TrainBatchViewModel()
        {
            Init();
        }
        public override Uri GetMyIcon()
        {
            return new Uri("../Resources/Images/bucket.png", UriKind.RelativeOrAbsolute);
        }

        #region Properties
        
        #region 已存组批
        private ObservableCollection<AnalysGroupInfo> savedGroup;
        public ObservableCollection<AnalysGroupInfo> SavedGroup
        {
            get { return savedGroup; }
            set
            {
                savedGroup = value;
                NotifyChanged("SavedGroup");

            }
        }

        private AnalysGroupInfo _selectedSavedGroup;
        public AnalysGroupInfo SelectedSavedGroup
        {
            get { return _selectedSavedGroup; }
            set
            {
                _selectedSavedGroup = value;
                NotifyChanged("SelectedSavedGroup");
                LoadGroup();
            }
        }

        #endregion

        #region 当日来车订单
        private ObservableCollection<POrder> pOrderList;
        public ObservableCollection<POrder> POrderList
        {
            get { return pOrderList; }
            set
            {
                pOrderList = value;
                NotifyChanged("POrderList");
            }
        }

        private POrder _selectedPOrder;
        public POrder SelectedPOrder
        {
            get { return _selectedPOrder; }
            set
            {
                _selectedPOrder = value;
                NotifyChanged("SelectedPOrder");
                GetSavedGroup();
                GetArrivedTrain();
            }
        }
        #endregion

        #region 订单车辆
        private ObservableCollection<TrainArrive2> trainArriveList;
        public ObservableCollection<TrainArrive2> TrainArriveList
        {
            get { return trainArriveList; }
            set
            {
                trainArriveList = value;
                NotifyChanged("TrainArriveList");
            }
        }

        #region 订单车辆表全选
        private string _selectAllName;

        public string SelectAllName
        {
            get { return _selectAllName; }

            set
            {
                _selectAllName = value;
                NotifyChanged("SelectAllName");
            }
        }

        private bool _selectAll;

        public bool SelectAll
        {
            get { return _selectAll; }

            set
            {
                _selectAll = value;
                NotifyChanged("SelectAll");
                // MakeSelectAll();
            }
        }

        public void MakeSelectAll()
        {
            
            if (trainArriveList != null && _selectAll == false)
            {
                foreach (var item in trainArriveList)
                {
                    if (item.NotGrouped)
                        item.IsSelected = true;
                }
                _selectAll = true;
                _selectAllName = "全不选";
            }
            else if (trainArriveList != null && _selectAll == true)
            {
                foreach (var item in trainArriveList)
                {
                    item.IsSelected = false;
                }
                _selectAll = false;
                _selectAllName = "全选";
            }
            this.TrainArriveList = trainArriveList;
            SelectAll = _selectAll;
            SelectAllName = _selectAllName;
        }

        public ICommand SelectOrUnSelectAll
        {
            get
            {
                return new DelegateCommand(() =>
                {
                    MakeSelectAll();
                });
            }
        }
        #endregion

        #endregion

        #region 编辑批次
        //private ObservableCollection<AnalysGroupInfo> editingGroup;
        //public ObservableCollection<AnalysGroupInfo> EditingGroup
        //{
        //    get { return editingGroup; }
        //    set
        //    {
        //        editingGroup = value;
        //        NotifyChanged("EditingGroup");
        //    }
        //}

        private EditGroup _editingGroup;
        public EditGroup EditingGroup
        {
            get { return _editingGroup; }
            set
            {
                _editingGroup = value;
                NotifyChanged("EditingGroup");
            }
        }
        #endregion

        #region MSG
        private string _errorMSG = null;
        public string ErrorMSG
        {
            get { return _errorMSG; }
            set
            {
                _errorMSG = value;
                NotifyChanged("ErrorMSG");
            }
        }

        private string _warningMSG = null;
        public string WarningMSG
        {
            get { return _warningMSG; }
            set
            {
                _warningMSG = value;
                NotifyChanged("WarningMSG");
            }
        }

        private bool _hasWarning=false;

        public bool HasWarning
        {
            get { return _hasWarning; }

            set
            {
                _hasWarning = value;
                NotifyChanged("HasWarning");
                // MakeSelectAll();
            }
        }

        private bool _isBatchEdit = false;

        public bool IsBatchEdit
        {
            get { return _isBatchEdit; }

            set
            {
                _isBatchEdit = value;
                NotifyChanged("IsBatchEdit");
                // MakeSelectAll();
            }
        }

        private int selectedSamplePoint;

        public int SelectedSamplePoint
        {
            get { return selectedSamplePoint; }

            set
            {
                selectedSamplePoint = value;
                NotifyChanged("SelectedSamplePoint");
                // MakeSelectAll();
            }
        }

        private bool _newOrAdd ;

        //true=new,false=add
        public bool NewOrAdd
        {
            get { return _newOrAdd; }

            set
            {
                _newOrAdd = value;
                NotifyChanged("NewOrAdd");
                
            }
        }
        #endregion

        #region 取样车厢列表
        private ObservableCollection<SampleTrainList> sampleTrainList;
        public ObservableCollection<SampleTrainList> SampleTrainList
        {
            get { return sampleTrainList; }
            set
            {
                sampleTrainList = value;
                NotifyChanged("SampleTrainList");
            }
        }

        #region 取样车厢全选
        private string _selectAllName2;

        public string SelectAllName2
        {
            get { return _selectAllName2; }

            set
            {
                _selectAllName2 = value;
                NotifyChanged("SelectAllName2");
            }
        }

        private bool _selectAll2;

        public bool SelectAll2
        {
            get { return _selectAll2; }

            set
            {
                _selectAll2 = value;
                NotifyChanged("SelectAll2");
                // MakeSelectAll();
            }
        }

        public void MakeSelectAll2()
        {
            if (sampleTrainList != null && _selectAll2 == false)
            {
                foreach (var item in sampleTrainList)
                {
                    item.IsSelected2 = true;
                }
                _selectAll2 = true;
                _selectAllName2 = "全不选";
            }
            else if (sampleTrainList != null && _selectAll2 == true)
            {
                foreach (var item in sampleTrainList)
                {
                    item.IsSelected2 = false;
                }
                _selectAll2 = false;
                _selectAllName2 = "全选";
            }
            this.SampleTrainList = sampleTrainList;
            SelectAll2 = _selectAll2;
            SelectAllName2 = _selectAllName2;
            if (EditingGroup != null) EditingGroup.IsEdit = true;
        }

        public ICommand SelectOrUnSelectAll2
        {
            get
            {
                return new DelegateCommand(() =>
                {
                    MakeSelectAll2();
                });
            }
        }
        #endregion
        #endregion
        #endregion

        #region Commands

        public void GetOrderList()
        {
            var list = sp.GetArrivedPOrder();
            pOrderList = new ObservableCollection<POrder>();
            foreach (var item in list)
            {
                var po = new POrder();
                po.PID = item.ID;
                po.POrderID = item.PurchaseOrderID;
                po.StrMateriel = item.Materiel.Name;
                po.StrSupplier = item.Supplier.SupplierName;
                po.VechileCount = sp.VechileCountWithDate(DateTime.Now, po.PID);
                po.InGroupCount = sp.GetGroupedNo(item.ID);
                po.MaterielID = item.Materiel.ID;
                pOrderList.Add(po);
            }
            this.POrderList = POrderList;
        }

       
        public void Init()
        {
            GetOrderList();
            _selectAllName = "全选";
            _selectAllName2 = "全选";
        }

        public ICommand Query
        {
            get
            {
                return new DelegateCommand(() =>
                {
                    GetOrderList();
                });
            }
        }

        public void GetSavedGroup()
        {
            savedGroup = new ObservableCollection<AnalysGroupInfo>();
            if (_selectedPOrder != null)
            {
                var list = sp.GetAnaGroupByPorder(_selectedPOrder.PID);
                foreach (var item in list)
                {
                    var ag = new AnalysGroupInfo();
                    ag.ID = item.ID;
                    ag.质检凭证号 = item.质检凭证号;
                    savedGroup.Add(ag);
                }
            }
            this.SavedGroup = savedGroup;
        }

        public void GetArrivedTrain()
        {
            trainArriveList = new ObservableCollection<TrainArrive2>();
            if (_selectedPOrder != null)
            {
                var list = sp.GetTrainbByPorder(_selectedPOrder.PID);
                foreach (var item in list)
                {
                    var ta = new TrainArrive2();
                    ta.IsSelected = false;
                    ta.NotGrouped = item.DeliverStatus == 9;
                    ta.ID = item.ID;
                    ta.StrStatus = sc.DicDiliverStatus[item.DeliverStatus];
                    ta.StrCarrageNo = item.Conveyance.Identity;
                    ta.ArrivalBatch = item.ArrivalBatch;
                    ta.MaterielID = item.PurchaseOrder.Materiel.ID;
                    if (item.StoragePlace != null)
                        ta.StockID = item.StoragePlace.ID;
                    
                    trainArriveList.Add(ta);
                }
            }
            this.TrainArriveList = trainArriveList;
        }

        public bool CheckWarning()
        {
            bool result=false;
            if (EditingGroup!=null&&EditingGroup.IsEdit)
            {
                result = true;
                _warningMSG = "继续操作会导致丢失未保存的组批数据，是否继续？";
            }
            else if (TrainArriveList==null||TrainArriveList.Count(o => o.IsSelected) <= 0)
            {
                result = true;
                _warningMSG = "未选中可操作的车厢。";
            }
            else if (!NewOrAdd && _selectedSavedGroup == null)
            {
                result = true;
                _warningMSG = "未选中可附加的组批号。";
            }
            return result;
        }

        public void TransferNewList()
        {
            sampleTrainList = new ObservableCollection<SampleTrainList>();
            foreach (var item in trainArriveList)
            {
                if (item.IsSelected && item.NotGrouped)
                {
                    var stl = new SampleTrainList();
                    stl.ArrivalBatch = item.ArrivalBatch;
                    stl.IsSelected2 = false;
                    stl.SampleMachine = 0;
                    stl.StrSampleMachine = sc.DicSampleMachine[0];
                    stl.ShipDocID = item.ID;
                    stl.StrCarrageNo = item.StrCarrageNo;
                    stl.MaterielID = item.MaterielID;
                    stl.NotSampled = true;
                    
                    sampleTrainList.Add(stl);
                }
            }
            this.SampleTrainList = sampleTrainList;
        }
        public void CreateNewGroup()
        {
            TransferNewList();
            if (sampleTrainList != null)
            {
                _editingGroup = new EditGroup();
                _editingGroup.质检凭证号 = sp.CreateAnalysBatchID(sampleTrainList[0].ShipDocID) + "*";
                _editingGroup.IsEdit = true;
               

            }
            this.EditingGroup = _editingGroup;
        }
        public ICommand NewGroup
        {
            get
            {
                return new DelegateCommand(() =>
                {
                    _newOrAdd = true;
                    
                    if (CheckWarning())
                    {
                        _hasWarning = true;
                        this.HasWarning = _hasWarning;
                        this.WarningMSG = _warningMSG;
                        NewOrAdd = _newOrAdd;
                    }
                    else
                    {
                        CreateNewGroup();
                    }
                });
            }
        }

        public void LoadGroup()
        {
            if (SelectedSavedGroup != null)
            {
                AddToOldGroup();
            }
        }

        public void AddToOldGroup()
        {
            _editingGroup = new EditGroup();
            _editingGroup.质检凭证号 = SelectedSavedGroup.质检凭证号 + "*";
            _editingGroup.ID = SelectedSavedGroup.ID;
            _editingGroup.IsEdit = true;
            this.EditingGroup = _editingGroup;

            sampleTrainList = new ObservableCollection<SampleTrainList>();

            if (SelectedSavedGroup != null)
            {
                var list = sp.GetAnalysCommissionsByGroupId(SelectedSavedGroup.ID);
                foreach (var item in list)
                {
                    var st = new SampleTrainList();
                    st.AnaCommID = item.ID;
                    st.ArrivalBatch = item.ShipDoc.ArrivalBatch;
                    st.IsSelected2 = false;
                    st.NotSampled = item.取样状态 == 0;
                    st.SamplePoint = item.PointCount;
                    st.ShipDocID = item.ShipDoc.ID;
                    st.StrCarrageNo = item.ShipDoc.Conveyance.Identity;
                    st.SampleMachine = item.BucketSample.取样设备号;
                    st.StrSampleMachine = sc.DicSampleMachine[st.SampleMachine];
                    st.StrStatus = sc.DicSampleStatus[item.取样状态];
                    st.BucketID = item.BucketSample.ID;
                    sampleTrainList.Add(st);
                }
            }

            foreach (var item in trainArriveList)
            {
                if (item.IsSelected && item.NotGrouped)
                {
                    var stl = new SampleTrainList();
                    stl.ArrivalBatch = item.ArrivalBatch;
                    stl.IsSelected2 = false;
                    stl.NotSampled = true;
                    stl.ShipDocID = item.ID;
                    stl.StrCarrageNo = item.StrCarrageNo;
                    sampleTrainList.Add(stl);
                }
            }
            this.SampleTrainList = sampleTrainList;
        }

        public ICommand AddGroup
        {
            get
            {
                return new DelegateCommand(() =>
                {
                    _newOrAdd = false;
                    if (CheckWarning())
                    {
                        _hasWarning = true;
                        this.HasWarning = _hasWarning;
                        this.WarningMSG = _warningMSG;
                        NewOrAdd = _newOrAdd;
                    }
                    else
                    {
                        AddToOldGroup();
                    }
                });
            }
        }

        public ICommand Continue
        {
            get
            {
                return new DelegateCommand(() =>
                {
                    if (NewOrAdd && TrainArriveList != null && TrainArriveList.Count(o => o.IsSelected) > 0)
                    {
                        CreateNewGroup();
                        this.HasWarning = false;
                    }
                    if (!NewOrAdd&&TrainArriveList != null && TrainArriveList.Count(o => o.IsSelected) > 0)
                    {
                        AddToOldGroup();
                        this.HasWarning = false;
                    }
                });
            }
        }

        public ICommand Quit
        {
            get
            {
                return new DelegateCommand(() =>
                {
                    this.HasWarning = false;

                });
            }
        }

        public ICommand Auto
        {
            get
            {
                return new DelegateCommand(() =>
                {
                    if (EditingGroup != null) EditingGroup.IsEdit = true;
                    sampleTrainList = this.SampleTrainList;
                    foreach (var item in sampleTrainList)
                    {
                        if (item.IsSelected2 && item.NotSampled)
                        {
                            item.SampleMachine = 1;
                            item.StrSampleMachine = sc.DicSampleMachine[1];
                        }
                    }
                    this.SampleTrainList = sampleTrainList;
                });
            }
        }

        public ICommand Manual
        {
            get
            {
                return new DelegateCommand(() =>
                {
                    if (EditingGroup != null) EditingGroup.IsEdit = true;
                    sampleTrainList = this.SampleTrainList;
                    foreach (var item in sampleTrainList)
                    {
                        if (item.IsSelected2 && item.NotSampled)
                        {
                            item.SampleMachine = 0;
                            item.StrSampleMachine = sc.DicSampleMachine[0];
                        }
                    }
                    this.SampleTrainList = sampleTrainList;
                });
            }
        }

        public ICommand Calculate
        {
            get
            {
                return new DelegateCommand(() =>
                {
                    if (EditingGroup != null) EditingGroup.IsEdit = true;
                    sampleTrainList = this.SampleTrainList;
                    Random rd = new Random();
                    foreach (var item in sampleTrainList)
                    {
                        if (item.IsSelected2 && item.NotSampled)
                        {
                           
                            item.SamplePoint = rd.Next(4);
                            //Thread.Sleep(10);
                        }
                    }
                    this.SampleTrainList = sampleTrainList;
                });
            }
        }

        public ICommand Modify
        {
            get
            {
                return new DelegateCommand(() =>
                {
                    if (EditingGroup != null) EditingGroup.IsEdit = true;
                    this.IsBatchEdit = true;
                });
            }
        }

        public ICommand Continue2
        {
            get
            {
                return new DelegateCommand(() =>
                {
                    if (EditingGroup != null) EditingGroup.IsEdit = true;
                    selectedSamplePoint = this.SelectedSamplePoint;
                    foreach (var item in sampleTrainList)
                    {
                        if (item.IsSelected2)
                        {
                            item.SamplePoint = selectedSamplePoint;
                        }
                    }
                    this.SampleTrainList = sampleTrainList;
                    this.IsBatchEdit = false;
                });
            }
        }

        public ICommand Quit2
        {
            get
            {
                return new DelegateCommand(() =>
                {
                    this.IsBatchEdit = false;

                });
            }
        }
        public ICommand Save
        {
            get
            {
                return new DelegateCommand(() =>
                {
                    _editingGroup=this.EditingGroup;
                    sampleTrainList = this.SampleTrainList;
                    //var bucketcount = sampleTrainList.Select(o => o.BucketID).Distinct().Count();
                    int[] i = { 0, 0 };

                    if (NewOrAdd)
                    {
                        var agInfo = new AnalysGroupInfo();
                        agInfo.质检凭证号 = _editingGroup.质检凭证号.Trim('*');
                        agInfo.物料 = new MaterielInfo() { ID = SampleTrainList[0].MaterielID };
                        agInfo.检验状态 = 0;
                        agInfo.创建时间 = DateTime.Now;
                        //agInfo.Stock = new StockInfo() { ID = sampleTrainList[0].StockID };
                        if (sp.CreateAnalysGroup(agInfo))
                        {
                            _editingGroup.ID = sp.GetAnalysGroupByBatchID(agInfo.质检凭证号);
                        }
                        else
                        {
                            _errorMSG = "新建组批失败";
                            return;
                        }
                    }
                    if (_editingGroup.ID.ToString() != "")
                    {
                        Guid[] bucketID = new Guid[2];
                        var bucketlist = sp.GetBucketByGroupID(_editingGroup.ID);
                        if (bucketlist.Count() >0)
                        {
                            foreach (var bi in bucketlist)
                            {
                                if (bi.取样设备号 == 0) bucketID[0] = bi.ID;
                                else bucketID[1] = bi.ID;
                            }
                        }
                        foreach (var sample in sampleTrainList)
                        {
                            if (sample.NotSampled)
                            {
                                string bid = bucketID[sample.SampleMachine].ToString();
                                if (bid == "00000000-0000-0000-0000-000000000000")
                                {
                                    var bucket = new BucketSampleInfo();
                                    bucket.AnalysGroup = new AnalysGroupInfo() { ID = _editingGroup.ID };
                                    bucket.取样设备号 = sample.SampleMachine;
                                    bucket.送样时间 = DateTime.Now;
                                    bucket.样桶数量 = 1;
                                    if (sp.CreateBucket(bucket))
                                    {
                                        bucketID[sample.SampleMachine] = sp.GetNewBucketID(_editingGroup.ID, sample.SampleMachine);
                                    }
                                    else
                                    {
                                        _errorMSG = "新建大样失败";
                                        return;
                                    }
                                }

                               
                                if (sample.AnaCommID.ToString() == "00000000-0000-0000-0000-000000000000")
                                {
                                    var anaComm = new AnalysCommissionInfo();
                                    anaComm.ShipDoc = new ShipDocInfo() { ID = sample.ShipDocID };
                                    anaComm.BucketSample = new BucketSampleInfo() { ID = bucketID[sample.SampleMachine] };
                                    anaComm.取样状态 = 0;
                                    anaComm.PointCount = sample.SamplePoint;
                                    anaComm.批序号 = i[sample.SampleMachine];
                                    if (sp.CreateAnaComm(anaComm))
                                    {
                                        if (sp.ModifyShipdocStatus(sample.ShipDocID, 10))
                                        {
                                            sample.AnaCommID = sp.GetNewAnaCommID(sample.ShipDocID);
                                            sample.IsSelected2 = false;
                                            i[sample.SampleMachine]++;
                                        }
                                    }
                                    else
                                    {
                                        _errorMSG = "新建取样委托失败";
                                        return;
                                    }
                                }
                                else
                                {
                                    var anaComm = sp.GetAnalysCommissionsId(sample.AnaCommID);
                                    anaComm.BucketSample = new BucketSampleInfo() { ID = bucketID[sample.SampleMachine] };
                                    anaComm.BucketSample.AnalysGroup = new AnalysGroupInfo() { ID = _editingGroup.ID };
                                    anaComm.取样状态 = 0;
                                    anaComm.PointCount = sample.SamplePoint;
                                    anaComm.批序号 = i[sample.SampleMachine];
                                    if (sp.ModifyAnaComm(anaComm))
                                    {
                                        if (sp.ModifyShipdocStatus(sample.ShipDocID, 10))
                                        {
                                            i[sample.SampleMachine]++;
                                            sample.IsSelected2 = false;
                                        }
                                    }
                                    else
                                    {
                                        _errorMSG = "更新取样委托失败";
                                        return;
                                    }
                                }
                            }
                        }

                        int bucketcount = 0;
                        foreach (var bID in bucketlist)
                        {
                            if (sp.BucketHasSample(bID.ID) > 0)
                            {
                                bucketcount++;
                            }
                            else
                            {
                                sp.DeleteBucket(bID.ID);
                            }
                        }
                        if (bucketcount == 2)
                        {
                            foreach (var bID in bucketlist)
                            {
                                sp.SetTwoBucket(bID.ID);
                            }
                        }
                        _editingGroup.质检凭证号 = _editingGroup.质检凭证号.Trim('*');
                        _editingGroup.IsEdit = false;
                        this.EditingGroup = _editingGroup;
                        GetSavedGroup();
                        GetOrderList();
                        GetArrivedTrain();
                    }
                });
            }
        }


        #endregion

       
    }

    public class WarningToVisibleConverter : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            bool s = (bool)value;
            if (s)
                return "Visible";
            else return "Collapsed";
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    public class LoadingVisibleConverter : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            bool s = (bool)value;
            if (s)
                return "Visible";
            else return "Hiden";
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    //public class AnaGroup:AnalysGroupInfo
    //{
    //    public AnaGroup() { }

    //    private bool _isEdit = false;

    //    public bool IsEdit
    //    {
    //        get { return _isEdit; }

    //        set
    //        {
    //            _isEdit = value;
    //        }
    //    }

    //}
    public class SampleTrainList:INPCBase
    {
        public SampleTrainList() { }

        private bool _isSelected ;

        public bool IsSelected2
        {
            get { return _isSelected; }

            set
            {
                _isSelected = value;
                NotifyChanged("IsSelected2");
            }
        }

        private bool _notSampled=false;

        public bool NotSampled
        {
            get { return _notSampled; }

            set
            {
                _notSampled = value;
                NotifyChanged("NotSampled");
            }
        }
        public Guid ShipDocID { get; set; }

        public Guid AnaCommID { get; set; }

        public Guid BucketID { get; set; }

        public Guid MaterielID { get; set; }

        public Guid StockID { get; set; }

        public string ArrivalBatch { get; set; }

        public string StrCarrageNo { get; set; }

        //public string StrSampleMachine { get; set; }

        public string StrStatus { get; set; }
        //public string SampleStatus { get; set; }

       
        private int samplePoint;

        public int SamplePoint
        {
            get { return samplePoint; }

            set
            {
                samplePoint = value;
                NotifyChanged("SamplePoint");
            }
        }


        private int sampleMachine;

        public int SampleMachine
        {
            get { return sampleMachine; }

            set
            {
                sampleMachine = value;
                NotifyChanged("SampleMachine");
            }
        }

        private string strSampleMachine;

        public string StrSampleMachine
        {
            get { return strSampleMachine; }

            set
            {
                strSampleMachine = value;
                NotifyChanged("StrSampleMachine");
            }
        }
    }

    public class EditGroup : AnalysGroupInfo
    {
        public EditGroup()
        {

        }

        private bool _isEdit = false;

        public bool IsEdit
        {
            get { return _isEdit; }

            set
            {
                _isEdit = value;
            }
        }
    }
}
